#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>



int main()
{
	int n;
	int i = 0;
	int j;
	int flag = 1;
	scanf("%d", &n);
	int arr[n][n];
	for (i = 0; i<n; i++)
	{
		for (j = 0; j<n; j++)
		{
			scanf("%d", &arr[i][j]);
			if (i>j && 0 != arr[i][j])
			{
				flag = 0;
			}
		}
	}

	if (1 == flag)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}